<?php

/**
 * model_divide
 */

class Model_divide extends YOU {

	public function __construct()
	{
		parent::__construct();
	}

	/** 读取成配置 **/
	public function getIni()
	{
		$divide_lists = $this->getAll();
		foreach ($divide_lists as $key => $value){
			$divide[$value['divide_id']] = $value['divide_name'];
		}

		return $divide;
	}
	/** 读取列表 **/
	public function getAll($field = "*")
	{
		$divide_lists = $this->db->fetchAll("SELECT {$field} FROM `tbl_student_divide` ");

		return $divide_lists;
	}

	/** 得到数据 **/
	public function getInfo($divide_id, $field = "*")
	{
		$divide_data = $this->db->fetchRow("SELECT {$field} FROM `tbl_student_divide` WHERE divide_id='{$divide_id}'");

		return $divide_data;
	}
	/** 通过班级得到 条件得到多条数据(有权限才能查询) **/
	public function getClassAll($class_id, $field = "*")
	{	
		$divide_data = $this->db->fetchAll("SELECT {$field} FROM `tbl_student_divide` WHERE class_id='{$class_id}'");

		return $divide_data;
	}
	/** 班级id->得到数据 **/
	public function getClassInfo($class_id, $field = "*")
	{
		$divide_data = $this->db->fetchRow("SELECT {$field} FROM `tbl_student_divide` WHERE class_id='{$class_id}'");

		return $divide_data;
	}

}


?>